Skip to contentSkip to conversation

Change in openvpn[master]: Haiku: Introduce basic platform / tun support

Openvpn-devel In review kallisti5 (Code Review) 2 participants 17 messages Nov 26, 2024 – Nov 28, 2024 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1732634928000.I9a278374f492a538f0c174ced1746c3b1f82b8c9@...2715...

#1 lore raw

Attention is currently required from: flichtenheld, plaisthos.

Hello plaisthos, flichtenheld,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/687?usp=email

to review the following change.

Change subject: Haiku: Introduce basic platform / tun support
......................................................................

Haiku: Introduce basic platform / tun support

* Special thanks to Sean Brady's hard work in GSoC 2023 towards creating a TUN/TAP driver for Haiku!
* More kudos to Augustin Cavalie for making it functional :-)

Change-Id: I9a278374f492a538f0c174ced1746c3b1f82b8c9
---
M configure.ac
M src/openvpn/tun.c

2 files changed, 22 insertions(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/87/687/1

configure.ac +5 -0
index 0876a6a..7f6e43d 100644
@@ -368,6 +368,11 @@
 		have_tap_header="yes"
 		ac_cv_header_net_if_h="no"	# exists, but breaks things
 		;;
+	*-*-haiku*)
+		AC_DEFINE([TARGET_HAIKU], [1], [Are we running Haiku?])
+		AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["H"], [Target prefix])
+		LIBS="${LIBS} -lnetwork"
+		;;
 	*)
 		AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["X"], [Target prefix])
 		have_tap_header="yes"
src/openvpn/tun.c +17 -0
index 85fe01a..e428fb9 100644
@@ -1631,6 +1631,16 @@
     {
         windows_set_mtu(tt->adapter_index, AF_INET, tun_mtu);
     }
+#elif defined(TARGET_HAIKU)
+    {
+        /* example: ifconfig tun/0 inet 1.1.1.1 255.255.255.0 mtu 1450 up */
+        /* XXX: Need to add ifconfig_remote_netmask since right now it is just NULL */
+        argv_printf(&argv, "%s %s inet %s %s mtu %d up", IFCONFIG_PATH,
+            ifname, ifconfig_local, ifconfig_remote_netmask, tun_mtu);
+
+        argv_msg(M_INFO, &argv);
+        openvpn_execve_check(&argv, es, S_FATAL, "Haiku ifconfig failed");
+    }
 #else  /* if defined(TARGET_LINUX) */
     msg(M_FATAL, "Sorry, but I don't know how to do 'ifconfig' commands on this operating system.  You should ifconfig your TUN/TAP device manually or use an --up script.");
 #endif /* if defined(TARGET_LINUX) */
@@ -1909,10 +1919,17 @@
         {
             for (int i = 0; i < 256; ++i)
             {
+#if defined(TARGET_HAIKU)
+                snprintf(tunname, sizeof(tunname),
+                         "/dev/%s/%d", dev, i);
+                snprintf(dynamic_name, sizeof(dynamic_name),
+                         "%s/%d", dev, i);
+#else
                 snprintf(tunname, sizeof(tunname),
                          "/dev/%s%d", dev, i);
                 snprintf(dynamic_name, sizeof(dynamic_name),
                          "%s%d", dev, i);
+#endif
                 if ((tt->fd = open(tunname, O_RDWR)) > 0)
                 {
                     dynamic_opened = true;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/687?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9a278374f492a538f0c174ced1746c3b1f82b8c9
Gerrit-Change-Number: 687
Gerrit-PatchSet: 1
Gerrit-Owner: kallisti5 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

Hello flichtenheld, plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/687?usp=email

to look at the new patch set (#2).

Change subject: Haiku: Introduce basic platform / tun support
......................................................................

Haiku: Introduce basic platform / tun support

* Special thanks to Sean Brady's hard work in GSoC 2023 towards creating a TUN/TAP driver for Haiku!
* More kudos to Augustin Cavalier for making it functional :-)

Change-Id: I9a278374f492a538f0c174ced1746c3b1f82b8c9
---
M configure.ac
M src/openvpn/tun.c

2 files changed, 22 insertions(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/87/687/2

configure.ac +5 -0
index 0876a6a..7f6e43d 100644
@@ -368,6 +368,11 @@
 		have_tap_header="yes"
 		ac_cv_header_net_if_h="no"	# exists, but breaks things
 		;;
+	*-*-haiku*)
+		AC_DEFINE([TARGET_HAIKU], [1], [Are we running Haiku?])
+		AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["H"], [Target prefix])
+		LIBS="${LIBS} -lnetwork"
+		;;
 	*)
 		AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["X"], [Target prefix])
 		have_tap_header="yes"
src/openvpn/tun.c +17 -0
index 85fe01a..e428fb9 100644
@@ -1631,6 +1631,16 @@
     {
         windows_set_mtu(tt->adapter_index, AF_INET, tun_mtu);
     }
+#elif defined(TARGET_HAIKU)
+    {
+        /* example: ifconfig tun/0 inet 1.1.1.1 255.255.255.0 mtu 1450 up */
+        /* XXX: Need to add ifconfig_remote_netmask since right now it is just NULL */
+        argv_printf(&argv, "%s %s inet %s %s mtu %d up", IFCONFIG_PATH,
+            ifname, ifconfig_local, ifconfig_remote_netmask, tun_mtu);
+
+        argv_msg(M_INFO, &argv);
+        openvpn_execve_check(&argv, es, S_FATAL, "Haiku ifconfig failed");
+    }
 #else  /* if defined(TARGET_LINUX) */
     msg(M_FATAL, "Sorry, but I don't know how to do 'ifconfig' commands on this operating system.  You should ifconfig your TUN/TAP device manually or use an --up script.");
 #endif /* if defined(TARGET_LINUX) */
@@ -1909,10 +1919,17 @@
         {
             for (int i = 0; i < 256; ++i)
             {
+#if defined(TARGET_HAIKU)
+                snprintf(tunname, sizeof(tunname),
+                         "/dev/%s/%d", dev, i);
+                snprintf(dynamic_name, sizeof(dynamic_name),
+                         "%s/%d", dev, i);
+#else
                 snprintf(tunname, sizeof(tunname),
                          "/dev/%s%d", dev, i);
                 snprintf(dynamic_name, sizeof(dynamic_name),
                          "%s%d", dev, i);
+#endif
                 if ((tt->fd = open(tunname, O_RDWR)) > 0)
                 {
                     dynamic_opened = true;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/687?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9a278374f492a538f0c174ced1746c3b1f82b8c9
Gerrit-Change-Number: 687
Gerrit-PatchSet: 2
Gerrit-Owner: kallisti5 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset

#3 lore raw
In reply to a message not in the archive

Attention is currently required from: kallisti5, plaisthos.

flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/687?usp=email )

Change subject: Haiku: Introduce basic platform / tun support
......................................................................

Patch Set 2:

(1 comment)

File src/openvpn/tun.c:

http://gerrit.openvpn.net/c/openvpn/+/687/comment/253bd262_14f53440 :
PS2, Line 1924: "/dev/%s/%d", dev, i);
It might be nicer to put the "/" into a variable (e.g. sep) and reduce the duplicated code this way?

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/687?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9a278374f492a538f0c174ced1746c3b1f82b8c9
Gerrit-Change-Number: 687
Gerrit-PatchSet: 2
Gerrit-Owner: kallisti5 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: kallisti5 <[email protected]...>
Gerrit-Comment-Date: Tue, 26 Nov 2024 17:13:12 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

#4 lore raw
In reply to a message not in the archive

Attention is currently required from: kallisti5, plaisthos.

Hello flichtenheld, plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/687?usp=email

to look at the new patch set (#3).

Change subject: Haiku: Introduce basic platform / tun support
......................................................................

Haiku: Introduce basic platform / tun support

* Special thanks to Sean Brady's hard work in GSoC 2023 towards creating a TUN/TAP driver for Haiku!
* More kudos to Augustin Cavalier for making it functional :-)

Change-Id: I9a278374f492a538f0c174ced1746c3b1f82b8c9
---
M configure.ac
M src/openvpn/tun.c

2 files changed, 22 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/87/687/3

configure.ac +5 -0
index 0876a6a..7f6e43d 100644
@@ -368,6 +368,11 @@
 		have_tap_header="yes"
 		ac_cv_header_net_if_h="no"	# exists, but breaks things
 		;;
+	*-*-haiku*)
+		AC_DEFINE([TARGET_HAIKU], [1], [Are we running Haiku?])
+		AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["H"], [Target prefix])
+		LIBS="${LIBS} -lnetwork"
+		;;
 	*)
 		AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["X"], [Target prefix])
 		have_tap_header="yes"
src/openvpn/tun.c +17 -2
index 85fe01a..f9fc28a 100644
@@ -1631,6 +1631,16 @@
     {
         windows_set_mtu(tt->adapter_index, AF_INET, tun_mtu);
     }
+#elif defined(TARGET_HAIKU)
+    {
+        /* example: ifconfig tun/0 inet 1.1.1.1 255.255.255.0 mtu 1450 up */
+        /* XXX: Need to add ifconfig_remote_netmask since right now it is just NULL */
+        argv_printf(&argv, "%s %s inet %s %s mtu %d up", IFCONFIG_PATH,
+            ifname, ifconfig_local, ifconfig_remote_netmask, tun_mtu);
+
+        argv_msg(M_INFO, &argv);
+        openvpn_execve_check(&argv, es, S_FATAL, "Haiku ifconfig failed");
+    }
 #else  /* if defined(TARGET_LINUX) */
     msg(M_FATAL, "Sorry, but I don't know how to do 'ifconfig' commands on this operating system.  You should ifconfig your TUN/TAP device manually or use an --up script.");
 #endif /* if defined(TARGET_LINUX) */
@@ -1909,10 +1919,15 @@
         {
             for (int i = 0; i < 256; ++i)
             {
+                /* some platforms have a dedicated directory per driver */
+                char sep = '';
+#if defined(TARGET_HAIKU)
+                sep = '/';
+#endif
                 snprintf(tunname, sizeof(tunname),
-                         "/dev/%s%d", dev, i);
+                         "/dev/%s%c%d", dev, sep, i);
                 snprintf(dynamic_name, sizeof(dynamic_name),
-                         "%s%d", dev, i);
+                         "%s%c%d", dev, sep, i);
                 if ((tt->fd = open(tunname, O_RDWR)) > 0)
                 {
                     dynamic_opened = true;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/687?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9a278374f492a538f0c174ced1746c3b1f82b8c9
Gerrit-Change-Number: 687
Gerrit-PatchSet: 3
Gerrit-Owner: kallisti5 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: kallisti5 <[email protected]...>
Gerrit-MessageType: newpatchset

#5 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

kallisti5 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/687?usp=email )

Change subject: Haiku: Introduce basic platform / tun support
......................................................................

Patch Set 3:

(1 comment)

File src/openvpn/tun.c:

http://gerrit.openvpn.net/c/openvpn/+/687/comment/7a82b408_da83a5ae :
PS2, Line 1924: "/dev/%s/%d", dev, i);

Quoted 1 line

It might be nicer to put the "/" into a variable (e.g. […]

Good call-out. Done in patchset 3. I'm rebooting to Haiku to test the sep stuff now.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/687?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9a278374f492a538f0c174ced1746c3b1f82b8c9
Gerrit-Change-Number: 687
Gerrit-PatchSet: 3
Gerrit-Owner: kallisti5 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 26 Nov 2024 17:28:21 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: flichtenheld <[email protected]...>
Gerrit-MessageType: comment

#6 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

Hello flichtenheld, plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/687?usp=email

to look at the new patch set (#4).

Change subject: Haiku: Introduce basic platform / tun support
......................................................................

Haiku: Introduce basic platform / tun support

* Special thanks to Sean Brady's hard work in GSoC 2023 towards creating a TUN/TAP driver for Haiku!
* More kudos to Augustin Cavalier for making it functional :-)

Change-Id: I9a278374f492a538f0c174ced1746c3b1f82b8c9
---
M INSTALL
M configure.ac
M src/openvpn/tun.c

3 files changed, 32 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/87/687/4

INSTALL +10 -0
index 6007338..9739272 100644
@@ -263,6 +263,16 @@
 
     http://www.whiteboard.ne.jp/~admin2/tuntap/
 
+* Haiku:
+
+   Haiku can't yet dynamically create TUN/TAP devices, so you need to manually
+   create one before running openvpn:
+
+     # ifconfig tun/0 up
+
+   A standard reference the dev as "tun" in your config is all that's needed
+   to use the tunnel device.
+
 * Windows
 
   OpenVPN on Windows needs a TUN/TAP kernel driver to work. OpenVPN installers
configure.ac +5 -0
index 0876a6a..7f6e43d 100644
@@ -368,6 +368,11 @@
 		have_tap_header="yes"
 		ac_cv_header_net_if_h="no"	# exists, but breaks things
 		;;
+	*-*-haiku*)
+		AC_DEFINE([TARGET_HAIKU], [1], [Are we running Haiku?])
+		AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["H"], [Target prefix])
+		LIBS="${LIBS} -lnetwork"
+		;;
 	*)
 		AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["X"], [Target prefix])
 		have_tap_header="yes"
src/openvpn/tun.c +17 -2
index 85fe01a..6e71392 100644
@@ -1631,6 +1631,16 @@
     {
         windows_set_mtu(tt->adapter_index, AF_INET, tun_mtu);
     }
+#elif defined(TARGET_HAIKU)
+    {
+        /* example: ifconfig tun/0 inet 1.1.1.1 255.255.255.0 mtu 1450 up */
+        /* XXX: Need to add ifconfig_remote_netmask since right now it is just NULL */
+        argv_printf(&argv, "%s %s inet %s %s mtu %d up", IFCONFIG_PATH,
+            ifname, ifconfig_local, ifconfig_remote_netmask, tun_mtu);
+
+        argv_msg(M_INFO, &argv);
+        openvpn_execve_check(&argv, es, S_FATAL, "Haiku ifconfig failed");
+    }
 #else  /* if defined(TARGET_LINUX) */
     msg(M_FATAL, "Sorry, but I don't know how to do 'ifconfig' commands on this operating system.  You should ifconfig your TUN/TAP device manually or use an --up script.");
 #endif /* if defined(TARGET_LINUX) */
@@ -1909,10 +1919,15 @@
         {
             for (int i = 0; i < 256; ++i)
             {
+                /* some platforms have a dedicated directory per driver */
+                char* sep = "";
+#if defined(TARGET_HAIKU)
+                sep = "/";
+#endif
                 snprintf(tunname, sizeof(tunname),
-                         "/dev/%s%d", dev, i);
+                         "/dev/%s%s%d", dev, sep, i);
                 snprintf(dynamic_name, sizeof(dynamic_name),
-                         "%s%d", dev, i);
+                         "%s%s%d", dev, sep, i);
                 if ((tt->fd = open(tunname, O_RDWR)) > 0)
                 {
                     dynamic_opened = true;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/687?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9a278374f492a538f0c174ced1746c3b1f82b8c9
Gerrit-Change-Number: 687
Gerrit-PatchSet: 4
Gerrit-Owner: kallisti5 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-MessageType: newpatchset

#7 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

kallisti5 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/687?usp=email )

Change subject: Haiku: Introduce basic platform / tun support
......................................................................

Patch Set 4:

(1 comment)

Patchset:

PS4:
patchset 4 that actually works... sorry too much rust development lately 😄

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/687?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9a278374f492a538f0c174ced1746c3b1f82b8c9
Gerrit-Change-Number: 687
Gerrit-PatchSet: 4
Gerrit-Owner: kallisti5 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Tue, 26 Nov 2024 17:46:26 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

#8 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, kallisti5, plaisthos.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/687?usp=email )

Change subject: Haiku: Introduce basic platform / tun support
......................................................................

Patch Set 4: Code-Review-1

(2 comments)

Patchset:

PS4:
there is this XXX comment which needs attention

File src/openvpn/tun.c:

http://gerrit.openvpn.net/c/openvpn/+/687/comment/ad542d93_0dcbfd0d :
PS4, Line 1637: /* XXX: Need to add ifconfig_remote_netmask since right now it is just NULL */
this XXX line irks me. What does it mean? Who needs to do something here?

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/687?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9a278374f492a538f0c174ced1746c3b1f82b8c9
Gerrit-Change-Number: 687
Gerrit-PatchSet: 4
Gerrit-Owner: kallisti5 <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: kallisti5 <[email protected]...>
Gerrit-Comment-Date: Wed, 27 Nov 2024 10:55:04 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment

#9 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, kallisti5, plaisthos.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/687?usp=email )

Change subject: Haiku: Introduce basic platform / tun support
......................................................................

Patch Set 4:

(1 comment)

Patchset:

PS4:
Oh, and please add a "signed-off-by:" line ;-)

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/687?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9a278374f492a538f0c174ced1746c3b1f82b8c9
Gerrit-Change-Number: 687
Gerrit-PatchSet: 4
Gerrit-Owner: kallisti5 <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: kallisti5 <[email protected]...>
Gerrit-Comment-Date: Wed, 27 Nov 2024 10:56:18 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

#10 lore raw
In reply to a message not in the archive

Attention is currently required from: cron2, flichtenheld, kallisti5, plaisthos.

Hello cron2, flichtenheld, plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/687?usp=email

to look at the new patch set (#5).

The following approvals got outdated and were removed:
Code-Review-1 by cron2

Change subject: Haiku: Introduce basic platform / tun support
......................................................................

Haiku: Introduce basic platform / tun support

* Special thanks to Sean Brady's hard work in GSoC 2023 towards creating a TUN/TAP driver for Haiku!
* More kudos to Augustin Cavalier for making it functional :-)

Change-Id: I9a278374f492a538f0c174ced1746c3b1f82b8c9
---
M INSTALL
M configure.ac
M src/openvpn/tun.c

3 files changed, 31 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/87/687/5

INSTALL +10 -0
index 6007338..9739272 100644
@@ -263,6 +263,16 @@
 
     http://www.whiteboard.ne.jp/~admin2/tuntap/
 
+* Haiku:
+
+   Haiku can't yet dynamically create TUN/TAP devices, so you need to manually
+   create one before running openvpn:
+
+     # ifconfig tun/0 up
+
+   A standard reference the dev as "tun" in your config is all that's needed
+   to use the tunnel device.
+
 * Windows
 
   OpenVPN on Windows needs a TUN/TAP kernel driver to work. OpenVPN installers
configure.ac +5 -0
index 0876a6a..7f6e43d 100644
@@ -368,6 +368,11 @@
 		have_tap_header="yes"
 		ac_cv_header_net_if_h="no"	# exists, but breaks things
 		;;
+	*-*-haiku*)
+		AC_DEFINE([TARGET_HAIKU], [1], [Are we running Haiku?])
+		AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["H"], [Target prefix])
+		LIBS="${LIBS} -lnetwork"
+		;;
 	*)
 		AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["X"], [Target prefix])
 		have_tap_header="yes"
src/openvpn/tun.c +16 -2
index 85fe01a..3355508 100644
@@ -1631,6 +1631,15 @@
     {
         windows_set_mtu(tt->adapter_index, AF_INET, tun_mtu);
     }
+#elif defined(TARGET_HAIKU)
+    {
+        /* example: ifconfig tun/0 inet 1.1.1.1 255.255.255.0 mtu 1450 up */
+        argv_printf(&argv, "%s %s inet %s %s mtu %d up", IFCONFIG_PATH,
+            ifname, ifconfig_local, ifconfig_remote_netmask, tun_mtu);
+
+        argv_msg(M_INFO, &argv);
+        openvpn_execve_check(&argv, es, S_FATAL, "Haiku ifconfig failed");
+    }
 #else  /* if defined(TARGET_LINUX) */
     msg(M_FATAL, "Sorry, but I don't know how to do 'ifconfig' commands on this operating system.  You should ifconfig your TUN/TAP device manually or use an --up script.");
 #endif /* if defined(TARGET_LINUX) */
@@ -1909,10 +1918,15 @@
         {
             for (int i = 0; i < 256; ++i)
             {
+                /* some platforms have a dedicated directory per driver */
+                char* sep = "";
+#if defined(TARGET_HAIKU)
+                sep = "/";
+#endif
                 snprintf(tunname, sizeof(tunname),
-                         "/dev/%s%d", dev, i);
+                         "/dev/%s%s%d", dev, sep, i);
                 snprintf(dynamic_name, sizeof(dynamic_name),
-                         "%s%d", dev, i);
+                         "%s%s%d", dev, sep, i);
                 if ((tt->fd = open(tunname, O_RDWR)) > 0)
                 {
                     dynamic_opened = true;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/687?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9a278374f492a538f0c174ced1746c3b1f82b8c9
Gerrit-Change-Number: 687
Gerrit-PatchSet: 5
Gerrit-Owner: kallisti5 <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: kallisti5 <[email protected]...>
Gerrit-MessageType: newpatchset

#11 lore raw
In reply to a message not in the archive

Attention is currently required from: cron2, flichtenheld, kallisti5, plaisthos.

Hello cron2, flichtenheld, plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/687?usp=email

to look at the new patch set (#6).

Change subject: Haiku: Introduce basic platform / tun support
......................................................................

Haiku: Introduce basic platform / tun support

* Special thanks to Sean Brady's hard work in GSoC 2023 towards creating a TUN/TAP driver for Haiku!
* More kudos to Augustin Cavalier for making it functional :-)

Change-Id I9a278374f492a538f0c174ced1746c3b1f82b8c9

---
M INSTALL
M configure.ac
M src/openvpn/tun.c

3 files changed, 31 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/87/687/6

INSTALL +10 -0
index 6007338..9739272 100644
@@ -263,6 +263,16 @@
 
     http://www.whiteboard.ne.jp/~admin2/tuntap/
 
+* Haiku:
+
+   Haiku can't yet dynamically create TUN/TAP devices, so you need to manually
+   create one before running openvpn:
+
+     # ifconfig tun/0 up
+
+   A standard reference the dev as "tun" in your config is all that's needed
+   to use the tunnel device.
+
 * Windows
 
   OpenVPN on Windows needs a TUN/TAP kernel driver to work. OpenVPN installers
configure.ac +5 -0
index 0876a6a..7f6e43d 100644
@@ -368,6 +368,11 @@
 		have_tap_header="yes"
 		ac_cv_header_net_if_h="no"	# exists, but breaks things
 		;;
+	*-*-haiku*)
+		AC_DEFINE([TARGET_HAIKU], [1], [Are we running Haiku?])
+		AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["H"], [Target prefix])
+		LIBS="${LIBS} -lnetwork"
+		;;
 	*)
 		AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["X"], [Target prefix])
 		have_tap_header="yes"
src/openvpn/tun.c +16 -2
index 85fe01a..3355508 100644
@@ -1631,6 +1631,15 @@
     {
         windows_set_mtu(tt->adapter_index, AF_INET, tun_mtu);
     }
+#elif defined(TARGET_HAIKU)
+    {
+        /* example: ifconfig tun/0 inet 1.1.1.1 255.255.255.0 mtu 1450 up */
+        argv_printf(&argv, "%s %s inet %s %s mtu %d up", IFCONFIG_PATH,
+            ifname, ifconfig_local, ifconfig_remote_netmask, tun_mtu);
+
+        argv_msg(M_INFO, &argv);
+        openvpn_execve_check(&argv, es, S_FATAL, "Haiku ifconfig failed");
+    }
 #else  /* if defined(TARGET_LINUX) */
     msg(M_FATAL, "Sorry, but I don't know how to do 'ifconfig' commands on this operating system.  You should ifconfig your TUN/TAP device manually or use an --up script.");
 #endif /* if defined(TARGET_LINUX) */
@@ -1909,10 +1918,15 @@
         {
             for (int i = 0; i < 256; ++i)
             {
+                /* some platforms have a dedicated directory per driver */
+                char* sep = "";
+#if defined(TARGET_HAIKU)
+                sep = "/";
+#endif
                 snprintf(tunname, sizeof(tunname),
-                         "/dev/%s%d", dev, i);
+                         "/dev/%s%s%d", dev, sep, i);
                 snprintf(dynamic_name, sizeof(dynamic_name),
-                         "%s%d", dev, i);
+                         "%s%s%d", dev, sep, i);
                 if ((tt->fd = open(tunname, O_RDWR)) > 0)
                 {
                     dynamic_opened = true;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/687?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9a278374f492a538f0c174ced1746c3b1f82b8c9
Gerrit-Change-Number: 687
Gerrit-PatchSet: 6
Gerrit-Owner: kallisti5 <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: kallisti5 <[email protected]...>
Gerrit-MessageType: newpatchset

#12 lore raw
In reply to a message not in the archive

Attention is currently required from: cron2, flichtenheld, plaisthos.

kallisti5 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/687?usp=email )

Change subject: Haiku: Introduce basic platform / tun support
......................................................................

Patch Set 6:

(1 comment)

File src/openvpn/tun.c:

http://gerrit.openvpn.net/c/openvpn/+/687/comment/d9705ee7_b7044362 :
PS4, Line 1637: /* XXX: Need to add ifconfig_remote_netmask since right now it is just NULL */

Quoted 1 line

this XXX line irks me. […]

It's a common old-school FIXME comment. (something searchable that something needs done)

https://stackoverflow.com/a/1452945

However, I do think the original reason for it being there no longer exists... Removed :-)

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/687?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9a278374f492a538f0c174ced1746c3b1f82b8c9
Gerrit-Change-Number: 687
Gerrit-PatchSet: 6
Gerrit-Owner: kallisti5 <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Wed, 27 Nov 2024 12:53:52 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: cron2 <[email protected]...>
Gerrit-MessageType: comment

#13 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, kallisti5, plaisthos.

cron2 has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/687?usp=email )

Change subject: Haiku: Introduce basic platform / tun support
......................................................................

Patch Set 6: Code-Review+2

(2 comments)

Patchset:

PS6:
LGTM. Tested via buildbots and GHA, and neither complain that we accidently broke something (well, uncrustify complains, but I'll fix that on the fly as it's "just whitespace")

File src/openvpn/tun.c:

http://gerrit.openvpn.net/c/openvpn/+/687/comment/2ba4bc97_2a2926cb :
PS4, Line 1637: /* XXX: Need to add ifconfig_remote_netmask since right now it is just NULL */

Quoted 1 line

It's a common old-school FIXME comment. (something searchable that something needs done) […]

I do understand XXX comments, I just do not want them in our code unless there really is something left to be fixed ;-) - so thanks for removing.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/687?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9a278374f492a538f0c174ced1746c3b1f82b8c9
Gerrit-Change-Number: 687
Gerrit-PatchSet: 6
Gerrit-Owner: kallisti5 <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Attention: kallisti5 <[email protected]...>
Gerrit-Comment-Date: Thu, 28 Nov 2024 10:15:00 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: cron2 <[email protected]...>
Comment-In-Reply-To: kallisti5 <[email protected]...>
Gerrit-MessageType: comment

#14 lore raw

PATCH v6 1/1 Haiku: Introduce basic platform / tun support

In reply to a message not in the archive

From: Alexander von Gluck <[email protected]...>

* Special thanks to Sean Brady's hard work in GSoC 2023 towards creating a TUN/TAP driver for Haiku!
* More kudos to Augustin Cavalier for making it functional :-)

Change-Id I9a278374f492a538f0c174ced1746c3b1f82b8c9

---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/687
This mail reflects revision 6 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

INSTALL +10 -0
index 6007338..9739272 100644
@@ -263,6 +263,16 @@
 
     http://www.whiteboard.ne.jp/~admin2/tuntap/
 
+* Haiku:
+
+   Haiku can't yet dynamically create TUN/TAP devices, so you need to manually
+   create one before running openvpn:
+
+     # ifconfig tun/0 up
+
+   A standard reference the dev as "tun" in your config is all that's needed
+   to use the tunnel device.
+
 * Windows
 
   OpenVPN on Windows needs a TUN/TAP kernel driver to work. OpenVPN installers
configure.ac +5 -0
index 0876a6a..7f6e43d 100644
@@ -368,6 +368,11 @@
 		have_tap_header="yes"
 		ac_cv_header_net_if_h="no"	# exists, but breaks things
 		;;
+	*-*-haiku*)
+		AC_DEFINE([TARGET_HAIKU], [1], [Are we running Haiku?])
+		AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["H"], [Target prefix])
+		LIBS="${LIBS} -lnetwork"
+		;;
 	*)
 		AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["X"], [Target prefix])
 		have_tap_header="yes"
src/openvpn/tun.c +16 -2
index 85fe01a..3355508 100644
@@ -1631,6 +1631,15 @@
     {
         windows_set_mtu(tt->adapter_index, AF_INET, tun_mtu);
     }
+#elif defined(TARGET_HAIKU)
+    {
+        /* example: ifconfig tun/0 inet 1.1.1.1 255.255.255.0 mtu 1450 up */
+        argv_printf(&argv, "%s %s inet %s %s mtu %d up", IFCONFIG_PATH,
+            ifname, ifconfig_local, ifconfig_remote_netmask, tun_mtu);
+
+        argv_msg(M_INFO, &argv);
+        openvpn_execve_check(&argv, es, S_FATAL, "Haiku ifconfig failed");
+    }
 #else  /* if defined(TARGET_LINUX) */
     msg(M_FATAL, "Sorry, but I don't know how to do 'ifconfig' commands on this operating system.  You should ifconfig your TUN/TAP device manually or use an --up script.");
 #endif /* if defined(TARGET_LINUX) */
@@ -1909,10 +1918,15 @@
         {
             for (int i = 0; i < 256; ++i)
             {
+                /* some platforms have a dedicated directory per driver */
+                char* sep = "";
+#if defined(TARGET_HAIKU)
+                sep = "/";
+#endif
                 snprintf(tunname, sizeof(tunname),
-                         "/dev/%s%d", dev, i);
+                         "/dev/%s%s%d", dev, sep, i);
                 snprintf(dynamic_name, sizeof(dynamic_name),
-                         "%s%d", dev, i);
+                         "%s%s%d", dev, sep, i);
                 if ((tt->fd = open(tunname, O_RDWR)) > 0)
                 {
                     dynamic_opened = true;
#15 lore raw

[Openvpn-devel] [PATCH applied] Re: Haiku: Introduce basic platform / tun support

Thanks for your contribution, and congratulations to having the first half of HAIKU support in OpenVPN :-)

I have no Haiku test system (yet...), so I have only looked at the change - in which ways will it affect other systems, does it follow our guidelines for formatting & buffer management, etc - and that is all fine.

There were some whitespace issues which I have fixed on the fly while merging. On 2/2, there's more issues, so please submit a new version.

Your patch has been applied to the master branch.

commit f80803710f74c1128f17cae285b6fa2754149d35 (master)

Author: Alexander von Gluck
Date:   Thu Nov 28 11:15:38 2024 +0100
     Haiku: Introduce basic platform / tun support

     Signed-off-by: Alexander von Gluck <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg29947.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#16 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#7) to the change originally created by kallisti5. ( http://gerrit.openvpn.net/c/openvpn/+/687?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by cron2

Change subject: Haiku: Introduce basic platform / tun support
......................................................................

Haiku: Introduce basic platform / tun support

* Special thanks to Sean Brady's hard work in GSoC 2023 towards creating a TUN/TAP driver for Haiku!
* More kudos to Augustin Cavalier for making it functional :-)

Change-Id I9a278374f492a538f0c174ced1746c3b1f82b8c9

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg29947.html

---
M INSTALL
M configure.ac
M src/openvpn/tun.c

3 files changed, 29 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/87/687/7

INSTALL +10 -0
index 6007338..9739272 100644
@@ -263,6 +263,16 @@
 
     http://www.whiteboard.ne.jp/~admin2/tuntap/
 
+* Haiku:
+
+   Haiku can't yet dynamically create TUN/TAP devices, so you need to manually
+   create one before running openvpn:
+
+     # ifconfig tun/0 up
+
+   A standard reference the dev as "tun" in your config is all that's needed
+   to use the tunnel device.
+
 * Windows
 
   OpenVPN on Windows needs a TUN/TAP kernel driver to work. OpenVPN installers
configure.ac +5 -0
index 0876a6a..7f6e43d 100644
@@ -368,6 +368,11 @@
 		have_tap_header="yes"
 		ac_cv_header_net_if_h="no"	# exists, but breaks things
 		;;
+	*-*-haiku*)
+		AC_DEFINE([TARGET_HAIKU], [1], [Are we running Haiku?])
+		AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["H"], [Target prefix])
+		LIBS="${LIBS} -lnetwork"
+		;;
 	*)
 		AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["X"], [Target prefix])
 		have_tap_header="yes"
src/openvpn/tun.c +14 -2
index 85fe01a..29d823d 100644
@@ -1631,6 +1631,13 @@
     {
         windows_set_mtu(tt->adapter_index, AF_INET, tun_mtu);
     }
+#elif defined(TARGET_HAIKU)
+    /* example: ifconfig tun/0 inet 1.1.1.1 255.255.255.0 mtu 1450 up */
+    argv_printf(&argv, "%s %s inet %s %s mtu %d up", IFCONFIG_PATH,
+                ifname, ifconfig_local, ifconfig_remote_netmask, tun_mtu);
+
+    argv_msg(M_INFO, &argv);
+    openvpn_execve_check(&argv, es, S_FATAL, "Haiku ifconfig failed");
 #else  /* if defined(TARGET_LINUX) */
     msg(M_FATAL, "Sorry, but I don't know how to do 'ifconfig' commands on this operating system.  You should ifconfig your TUN/TAP device manually or use an --up script.");
 #endif /* if defined(TARGET_LINUX) */
@@ -1909,10 +1916,15 @@
         {
             for (int i = 0; i < 256; ++i)
             {
+                /* some platforms have a dedicated directory per driver */
+                char *sep = "";
+#if defined(TARGET_HAIKU)
+                sep = "/";
+#endif
                 snprintf(tunname, sizeof(tunname),
-                         "/dev/%s%d", dev, i);
+                         "/dev/%s%s%d", dev, sep, i);
                 snprintf(dynamic_name, sizeof(dynamic_name),
-                         "%s%d", dev, i);
+                         "%s%s%d", dev, sep, i);
                 if ((tt->fd = open(tunname, O_RDWR)) > 0)
                 {
                     dynamic_opened = true;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/687?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9a278374f492a538f0c174ced1746c3b1f82b8c9
Gerrit-Change-Number: 687
Gerrit-PatchSet: 7
Gerrit-Owner: kallisti5 <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: newpatchset

#17 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/687?usp=email )

Change subject: Haiku: Introduce basic platform / tun support
......................................................................

Haiku: Introduce basic platform / tun support

* Special thanks to Sean Brady's hard work in GSoC 2023 towards creating a TUN/TAP driver for Haiku!
* More kudos to Augustin Cavalier for making it functional :-)

Change-Id I9a278374f492a538f0c174ced1746c3b1f82b8c9

Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg29947.html

---
M INSTALL
M configure.ac
M src/openvpn/tun.c

3 files changed, 29 insertions(+), 2 deletions(-)
INSTALL +10 -0
index 6007338..9739272 100644
@@ -263,6 +263,16 @@
 
     http://www.whiteboard.ne.jp/~admin2/tuntap/
 
+* Haiku:
+
+   Haiku can't yet dynamically create TUN/TAP devices, so you need to manually
+   create one before running openvpn:
+
+     # ifconfig tun/0 up
+
+   A standard reference the dev as "tun" in your config is all that's needed
+   to use the tunnel device.
+
 * Windows
 
   OpenVPN on Windows needs a TUN/TAP kernel driver to work. OpenVPN installers
configure.ac +5 -0
index 0876a6a..7f6e43d 100644
@@ -368,6 +368,11 @@
 		have_tap_header="yes"
 		ac_cv_header_net_if_h="no"	# exists, but breaks things
 		;;
+	*-*-haiku*)
+		AC_DEFINE([TARGET_HAIKU], [1], [Are we running Haiku?])
+		AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["H"], [Target prefix])
+		LIBS="${LIBS} -lnetwork"
+		;;
 	*)
 		AC_DEFINE_UNQUOTED([TARGET_PREFIX], ["X"], [Target prefix])
 		have_tap_header="yes"
src/openvpn/tun.c +14 -2
index 85fe01a..29d823d 100644
@@ -1631,6 +1631,13 @@
     {
         windows_set_mtu(tt->adapter_index, AF_INET, tun_mtu);
     }
+#elif defined(TARGET_HAIKU)
+    /* example: ifconfig tun/0 inet 1.1.1.1 255.255.255.0 mtu 1450 up */
+    argv_printf(&argv, "%s %s inet %s %s mtu %d up", IFCONFIG_PATH,
+                ifname, ifconfig_local, ifconfig_remote_netmask, tun_mtu);
+
+    argv_msg(M_INFO, &argv);
+    openvpn_execve_check(&argv, es, S_FATAL, "Haiku ifconfig failed");
 #else  /* if defined(TARGET_LINUX) */
     msg(M_FATAL, "Sorry, but I don't know how to do 'ifconfig' commands on this operating system.  You should ifconfig your TUN/TAP device manually or use an --up script.");
 #endif /* if defined(TARGET_LINUX) */
@@ -1909,10 +1916,15 @@
         {
             for (int i = 0; i < 256; ++i)
             {
+                /* some platforms have a dedicated directory per driver */
+                char *sep = "";
+#if defined(TARGET_HAIKU)
+                sep = "/";
+#endif
                 snprintf(tunname, sizeof(tunname),
-                         "/dev/%s%d", dev, i);
+                         "/dev/%s%s%d", dev, sep, i);
                 snprintf(dynamic_name, sizeof(dynamic_name),
-                         "%s%d", dev, i);
+                         "%s%s%d", dev, sep, i);
                 if ((tt->fd = open(tunname, O_RDWR)) > 0)
                 {
                     dynamic_opened = true;

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/687?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9a278374f492a538f0c174ced1746c3b1f82b8c9
Gerrit-Change-Number: 687
Gerrit-PatchSet: 7
Gerrit-Owner: kallisti5 <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: merged